package com.xiaorun.portal.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaorun.portal.dao.NewsAttachMapper;
import com.xiaorun.portal.dao.NewsMapper;
import com.xiaorun.portal.modal.Bo.Query;
import com.xiaorun.portal.modal.Vo.News;
import com.xiaorun.portal.modal.Vo.NewsAttach;
import com.xiaorun.portal.service.INewsAttachService;
import com.xiaorun.portal.service.INewsService;
import com.xiaorun.portal.utils.TaleUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils;

import javax.xml.bind.DatatypeConverter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by BlueT on 2018/3/3.
 */
@Service
@Slf4j
public class NewsAttachServiceImpl implements INewsAttachService {

    @Autowired
    private NewsAttachMapper newsAttachMapper;


    @Override
    public int save(NewsAttach newsAttach) {
        return 0;
    }

    @Override
    public int batchSave(List<NewsAttach> newsAttachList) {
        return newsAttachMapper.batchSave(newsAttachList);
    }

    @Override
    public List<NewsAttach> list(Map<String, Object> params) {
        Query query = new Query(params != null ? params: new HashMap<>());
        List<NewsAttach> newsAttachList = newsAttachMapper.list(query);
        return newsAttachList;
    }
}
